package com.gitee.swsk33.catcomment.api;

import com.gitee.swsk33.catcomment.service.CommentService;
import com.gitee.swsk33.catentity.dataobject.Comment;
import com.gitee.swsk33.catentity.model.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/comment")
public class CommentAPI {

	@Autowired
	private CommentService commentService;

	@PostMapping("/add")
	public Result<Void> add(@RequestBody Comment comment) {
		return commentService.add(comment);
	}

	@GetMapping("/get/{id}")
	public Result<Comment> getById(@PathVariable("id") int id) {
		return commentService.getById(id);
	}

}